<template>
  <div class="app-container">
    <div class="total-layout">
      <div class="layout-title">数据统计</div>
      <el-row :gutter="20">
        <el-col :span="6">
          <div class="total-frame">
            <img :src="img_home_order" class="total-icon">
            <div class="total-title">今日注册人数</div>
            <div class="total-value">{{data.userCount}}</div>
          </div>
        </el-col>
        <el-col :span="6">
          <div class="total-frame">
            <img :src="img_home_today_amount" class="total-icon">
            <div class="total-title">今日申请代卖商品数</div>
            <div class="total-value">￥{{data.newProductCount}}</div>
          </div>
        </el-col>
        <el-col :span="6">
          <div class="total-frame">
            <img :src="img_home_yesterday_amount" class="total-icon">
            <div class="total-title">今日上传商品数</div>
            <div class="total-value">{{data.productCount}}</div>
          </div>
        </el-col>
        <el-col :span="6">
          <div class="total-frame">
            <svg-icon icon-class="total-week" class="total-icon">
            </svg-icon>
            <div class="total-title">今日下单数</div>
            <div class="total-value">￥{{data.orderCount}}</div>
          </div>
        </el-col>
      </el-row>
    </div>
    <div class="un-handle-layout">
      <div class="layout-title">待处理事务</div>
      <div class="un-handle-content">
        <el-row :gutter="20">
          <el-col :span="12">
            <div class="un-handle-item">
              <span class="font-medium">待付款订单</span>
              <span style="float: right" class="color-danger">( {{orderData.dfk}} )</span>
            </div>
          </el-col>
          <el-col :span="12">
            <div class="un-handle-item">
              <span class="font-medium">待发货订单</span>
              <span style="float: right" class="color-danger">({{orderData.dfh}})</span>
            </div>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="12">
            <div class="un-handle-item">
              <span class="font-medium">已发货订单</span>
              <span style="float: right" class="color-danger">({{orderData.yfh}})</span>
            </div>
          </el-col>
          <el-col :span="12">
            <div class="un-handle-item">
              <span class="font-medium">已完成订单</span>
              <span style="float: right" class="color-danger">({{orderData.ywc}})</span>
            </div>
          </el-col>
        </el-row>
      </div>
    </div>
    <div class="statistics-layout">
    </div>
  </div>
</template>

<script>
    import {fetchData, fetchOrderData} from '@/api/home';
    import img_home_order from '@/assets/images/home_order.png';
    import img_home_today_amount from '@/assets/images/home_today_amount.png';
    import img_home_yesterday_amount from '@/assets/images/home_yesterday_amount.png';


    export default {
        name: 'home',
        data() {
            return {
                img_home_order,
                img_home_today_amount,
                img_home_yesterday_amount,
                data: {
                    userCount: 0,
                    newProductCount: 0,
                    orderCount: 0,
                    productCount: 0
                },
                orderData: {
                    dfk: 0,
                    dfh: 0,
                    yfh: 0,
                    ywc: 0
                }
            }
        },
        created() {
            console.info("sdfafasdfafsad");
            this.handGetData();
        },
        methods: {
            handGetData() {
                setTimeout(() => {
                    fetchData().then(response => {
                        this.data = response.data;
                    }),
                    fetchOrderData().then(response => {
                        this.data = response.orderData;
                    })
                }, 1000)
            }
        }
    }
</script>

<style scoped>
  .app-container {
    margin-top: 40px;
    margin-left: 120px;
    margin-right: 120px;
  }

  .address-layout {
  }

  .total-layout {
    margin-top: 20px;
  }

  .total-frame {
    border: 1px solid #DCDFE6;
    padding: 20px;
    height: 100px;
  }

  .total-icon {
    color: #409EFF;
    width: 60px;
    height: 60px;
  }

  .total-title {
    position: relative;
    font-size: 16px;
    color: #909399;
    left: 70px;
    top: -50px;
  }

  .total-value {
    position: relative;
    font-size: 18px;
    color: #606266;
    left: 70px;
    top: -40px;
  }

  .un-handle-layout {
    margin-top: 20px;
    border: 1px solid #DCDFE6;
  }

  .layout-title {
    color: #606266;
    padding: 15px 20px;
    background: #F2F6FC;
    font-weight: bold;
  }

  .un-handle-content {
    padding: 20px 40px;
  }

  .un-handle-item {
    border-bottom: 1px solid #EBEEF5;
    padding: 10px;
  }

  .overview-layout {
    margin-top: 20px;
  }

  .overview-item-value {
    font-size: 24px;
    text-align: center;
  }

  .overview-item-title {
    margin-top: 10px;
    text-align: center;
  }

  .out-border {
    border: 1px solid #DCDFE6;
  }

  .statistics-layout {
    margin-top: 20px;
    border: 1px solid #DCDFE6;
  }

  .mine-layout {
    position: absolute;
    right: 140px;
    top: 107px;
    width: 250px;
    height: 235px;
  }

  .address-content {
    padding: 20px;
    font-size: 18px
  }
</style>
